package com.iwomy.secureplat.platform.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.iwomy.secureplat.platform.dto.BasicDeviceAttributeDataDTO;
import com.iwomy.secureplat.platform.entity.BasicDeviceAttributeDataEntity;
import com.iwomy.secureplat.platform.entity.BasicDeviceAttributeEntity;
import com.iwomy.secureplat.platform.mapper.BasicDeviceAttributeDataMapper;
import com.iwomy.secureplat.platform.service.BasicDeviceAttributeDataService;
import com.iwomy.secureplat.platform.vo.BasicDeviceAttributeDataVO;
import com.iwomy.secureplat.platform.vo.BasicDeviceAttributeVO;
import org.springframework.stereotype.Service;
/**
 * 设备属性值和设备关系表
 *
 * @author pig
 * @date 2023-11-27 18:29:01
 */
@Service
public class BasicDeviceAttributeDataServiceImpl extends ServiceImpl<BasicDeviceAttributeDataMapper, BasicDeviceAttributeDataEntity> implements BasicDeviceAttributeDataService {
	@Override
	public Page<BasicDeviceAttributeDataVO> getBasicDeviceAttributeDataPage(Page page, BasicDeviceAttributeDataDTO basicDeviceAttributeDataDTO) {
		//多表查询
		MPJLambdaWrapper<BasicDeviceAttributeDataEntity> wrapper = new MPJLambdaWrapper<>();
		wrapper.selectAll(BasicDeviceAttributeDataEntity.class)
				.selectAs(BasicDeviceAttributeEntity::getAttributeName, BasicDeviceAttributeDataVO::getAttributeName)
				.leftJoin(BasicDeviceAttributeEntity.class, BasicDeviceAttributeEntity::getId, BasicDeviceAttributeDataEntity::getAttributeId);

		return this.getBaseMapper().selectJoinPage(page, BasicDeviceAttributeDataVO.class, wrapper);
	}
}